package com.heima.health.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.heima.health.pojo.Setmeal;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface SetmealMapper extends BaseMapper<Setmeal> {

    @Delete("delete from t_setmeal_checkgroup where SETMEAL_ID = #{sid}")
    void deleteGidBySid(@Param("sid") Integer sid);

    @Insert("INSERT INTO t_setmeal_checkgroup VALUES(#{sid},#{gid});")
    void insertGidBySId(@Param("sid")Integer sid, @Param("gid")Integer groupId);

    @Select("SELECT CHECKGROUP_ID FROM t_setmeal_checkgroup WHERE SETMEAL_ID=#{sid}")
    Integer[] findIds(@Param("sid")Integer sid);

    @Select("SELECT img FROM t_setmeal WHERE id=#{sid}")
    String findImgBySid(@Param("sid")Integer sid);
}
